package maximizeSum;

import java.util.Arrays;

public class Solution {
    public int maximizeSum(int[] nums, int k) {
        // nums.max -- nums.max + k
        int n = Arrays.stream(nums).max().getAsInt();
        return k*(n + n + k - 1)/2;  // Sn = n*(A1+An)/2
    }
}
